package paymentSystem;

public class PaymentSystemProxy implements paymentSystem.PaymentSystem {
  private String _endpoint = null;
  private paymentSystem.PaymentSystem paymentSystem = null;
  
  public PaymentSystemProxy() {
    _initPaymentSystemProxy();
  }
  
  public PaymentSystemProxy(String endpoint) {
    _endpoint = endpoint;
    _initPaymentSystemProxy();
  }
  
  private void _initPaymentSystemProxy() {
    try {
      paymentSystem = (new paymentSystem.PaymentSystemServiceLocator()).getPaymentSystemPort();
      if (paymentSystem != null) {
        if (_endpoint != null)
          ((javax.xml.rpc.Stub)paymentSystem)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
        else
          _endpoint = (String)((javax.xml.rpc.Stub)paymentSystem)._getProperty("javax.xml.rpc.service.endpoint.address");
      }
      
    }
    catch (javax.xml.rpc.ServiceException serviceException) {}
  }
  
  public String getEndpoint() {
    return _endpoint;
  }
  
  public void setEndpoint(String endpoint) {
    _endpoint = endpoint;
    if (paymentSystem != null)
      ((javax.xml.rpc.Stub)paymentSystem)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
    
  }
  
  public paymentSystem.PaymentSystem getPaymentSystem() {
    if (paymentSystem == null)
      _initPaymentSystemProxy();
    return paymentSystem;
  }
  
  public int doPayment(java.lang.Integer arg0) throws java.rmi.RemoteException{
    if (paymentSystem == null)
      _initPaymentSystemProxy();
    return paymentSystem.doPayment(arg0);
  }
  
  public void paymentRedirect(java.lang.Integer arg0) throws java.rmi.RemoteException{
    if (paymentSystem == null)
      _initPaymentSystemProxy();
    paymentSystem.paymentRedirect(arg0);
  }
  
  
}